<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Statement" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:useBean id="username" class="com.UserBean" scope="application"></jsp:useBean>
<jsp:setProperty name="username" property="*"></jsp:setProperty>



<%

        Class.forName("com.mysql.jdbc.Driver");
        String url= "jdbc:mysql://127.0.0.1:3306/book?user=root&password=root";
        Connection connection= DriverManager.getConnection(url);

        //String sql="insert into user (username,password,gender,age) values('"+user.getUsername()+"','"+user.getPassword()+"',1,23)";
        Statement stmt=connection.createStatement();
        //String sql="update user set status=3 where id=7";
        String sql="delete from user where id=7";
        int count=stmt.executeUpdate(sql);
        if(count==0){
                out.println("更新失败");
        }else{
                out.println("更新成功");
        }
%>


<jsp:getProperty name="user" property="username"/>

<html>
<head>
        <title>Title</title>
</head>
<body>

</body>
</html>